/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package SensorImpl;

import SensorInterface.ISensor;
import CommonValue.Pressure;
import DTO.SensorDTO;
import java.util.Random;

public class PressureSensor extends BaseSensor implements ISensor {

    private static int count;

    public PressureSensor(String location) {
        count++;
        setNumber(count);
        setSensorSign(Pressure.SIGN);
        setLocation(location);
    }

    @Override
    public SensorDTO generateData() {
        SensorDTO sdto = new SensorDTO(getSensorSign(),getNumber(),getLocation());
        Random rd = new Random();
        float f = rd.nextInt(20) + 20 + rd.nextInt(10) + rd.nextFloat();
        sdto.addData(Pressure.PRESSURE, f);
        return sdto;
    }

    @Override
    public void printData(SensorDTO sdto) {
        if (!isMatchSign(sdto)) {
            return;
        }
        System.out.println(Pressure.PRESSURE + " : "+ sdto.getData().get(Pressure.PRESSURE));
    }
}